package com.ry.project.demo.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ry.project.demo.bean.Dept;
import com.ry.project.demo.mapper.DeptMapper;

@Service
public class DeptServiceImpl implements IDeptService {

	@Autowired
	private DeptMapper deptMapper;
	
	@Override
	public List<Dept> getDataList() {
		return deptMapper.getDataList();
	}
	
	@Override
	public int save(Dept d) {
		return deptMapper.save(d);
	}
	
	@Override
	public int delete(int deptid) {
		return deptMapper.delete(deptid);
	}
	
	//测试事务
	@Transactional
	public int testTransactional(Dept d, int deptid) {
		int a = deptMapper.delete(deptid);
		System.out.println("输出结果 " + a);
		return deptMapper.save(d);
	}
	
}
